package src.org.jess.serv;


import org.eclipse.jetty.websocket.WebSocket;  

public class SearchServlet implements WebSocket{  
  
    public void onClose(int arg0, String arg1) {  
        System.out.println("onClose");  
    }  
  
    public void onOpen(final Connection conn) {  
        System.out.println("onOpen");  
         new Thread() {  
             @Override  
             public void run() {  
                 try {  
                     conn.sendMessage("congratulations,you have conneted to server!");  
                     int i =0;  
                     while (true) {  
                         sleep(1000);  
                         conn.sendMessage("Count:" + (i++));  
                     }  
                 } catch (final Exception e) {  
                     System.err.println(e.getMessage());  
                 }  
             }  
         }.start();  
    }  
  
}  
